package javaLanguage.factory;

public class simpleFac {
    public static getColor createGetColr(String name){
        if(name == "blue") return new bluePen();
        if(name == "red") return new redPen();
        return new nullPen();
    }

}

class bluePen implements getColor{
    @Override
    public void printColor() {
        System.out.println("这是蓝色的！");
    }
}

class redPen implements getColor{
    @Override
    public void printColor() {
        System.out.println("这是红色的！");
    }
}

class nullPen implements getColor{
    @Override
    public void printColor() {
        System.out.println("搞不清楚是什么颜色！");
    }
}